<template>
	<view class="tixian">
		<view class="top">
			<image src='../../static/businessImg/back.png'  class="topback" @click="back">
			</image> 
			<view class="topname">
				可提现金额
			</view>
		</view>

		<view class="tixiancenter">
			<view class="tixiancenteritem">
				<view class="tixiancenteritem1">
					可提现金额
				</view>
				<view class="tixiancenteritem2">
					{{price}}
				</view>
			</view>

			<view class="tixiancenteritem" style="margin-top: 38rpx;">
				<view class="tixiancenteritem1">
					申请提现金额
				</view>
				<input class="tixiancenteritem2" style="color: #0D182E;" placeholder="请输入提现金额" v-model="tixianprice">

				</input>
			</view>

	<!-- @click="navigateTo('/pages/business/tixianed')" -->
			<view class="tixianbtn" 
				@click="handleTixian"
			>
				确认申请
			</view>
		</view>

		<view class="tixianlast" @click="navigateTo('/pages/business/tixianorder')">
			<view class="tixianlasttitle">
				提现订单
			</view>

			<u-image src='../../static/businessImg/go.png' width="16" height="29"></u-image>
		</view>
	</view>
</template>

<script>
	
	import storage from '@/utils/storage.js';
	import {
		balanceWithdrawal
	} from '@/api/storeAdmin.js'
	export default {
		data() {
			return {
				price: 0,
				tixianprice: ''
			}
		},
		
		onLoad(option) {
			this.price = option.price;
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
			navigateTo(url) {
				uni.navigateTo({
					url: url
				})
			},
			handleTixian(){
				if(this.price == 0){
					return uni.showToast({
						icon:'none',
						title:'可提现余额不足'
					})
				}
				
				if(this.tixianprice == '' || this.tixianprice ==0){
					return  uni.showToast({
						icon:'none',
						title:'请输入申请体现金额'
					})
				}
				balanceWithdrawal({
					price: this.tixianprice,
					storeId: storage.getUserInfo().storeId,
				}).then(res => {
					if(res.code == '000000'){
						this.navigateTo(`/pages/business/tixianed?createTime=${res.data.createTime}&name=${res.data.name}&price=${res.data.price}`)
					}
				})
			}
		}
	}
</script>

<style scoped>
	.tixian {
		width: 100%;
		min-height: 100vh;
		background: #F0F0F0;
	}

	.top {
		width: 100%;
		height: 188rpx;
		position: relative;
		background: #FFFFFF;
	}

	.topback {
		width: 16rpx;
		height: 29rpx;
		position: absolute;
		top: 106rpx;
		left: 32rpx;
	}

	.topname {
		width: 300rpx;
		height: 32rpx;
		text-align: center;
		font-family: Adobe Heiti Std;
		font-weight: normal;
		font-size: 33rpx;
		color: #222222;
		line-height: 32rpx;
		position: absolute;
		top: 104rpx;
		left: 50%;
		transform: translateX(-50%);
	}

	.tixiancenter {
		width: 703rpx;
		height: 320rpx;
		margin: 27rpx auto;
		background: #FFFFFF;
		padding: 36rpx;
	}

	.tixiancenteritem {
		height: 55rpx;
		width: 100%;
		line-height: 55rpx;
		border-bottom: 2rpx solid #f3f3f3;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.tixiancenteritem1 {
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 25rpx;
		color: #000000;
		height: 100%;
		width: 50%;
		text-align: left;
	}

	.tixiancenteritem2 {
		font-family: Source Han Sans CN;
		font-weight: 400;
		font-size: 27rpx;
		color: #F14343;
		width: 50%;
		height: 100%;
		text-align: right;
	}

	.tixianbtn {
		width: 248rpx;
		height: 71rpx;
		line-height: 71rpx;
		text-align: center;
		margin: 36rpx auto;
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 32rpx;
		color: #FFFFFF;
		background: rgb(40, 199, 73);
		border-radius: 40rpx;
	}

	.tixianlast {
		width: 703rpx;
		height: 106rpx;
		padding: 0 35rpx;
		background: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 0 auto;
	}

	.tixianlasttitle {
		width: 50%;
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 32rpx;
		color: #000000; 

	}
</style>
